#ifndef SENSOR_CONFIG_H
#define SENSOR_CONFIG_H

static unsigned int sensor_config[370]={
        0x56, 0x0C, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00,
        0x00, 0x00, 0x00, 0x00, 0xAB, 0x17, 0x01, 0x00,
        0x00, 0x01, 0x00, 0x18, 0x00 ,0x90, 0x17, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0xAC, 0x17, 0x00, 0x00, 0x06,
        0x04, 0x04, 0x04, 0xC4, 0x00, 0x20, 0x20, 0x04,
        0x00, 0x05, 0x00, 0x05, 0x01, 0x04, 0x00, 0x8B,
        0x15, 0xFF, 0x07, 0x01, 0x00, 0x00, 0x86, 0x01,
        0x90, 0x02, 0x0C, 0x00, 0x01, 0xEC, 0xF5, 0xFF,
        0xFF, 0x72, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
        0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
        0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x76, 0xFD, 0xFF,
        0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9,
        0x34, 0xF4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
        0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xA9, 0xFC,
        0x9F, 0xCA, 0xFF, 0xD9, 0xFC, 0x9F, 0xCD, 0xFF,
        0x76, 0xFD, 0xFF, 0xFF, 0xFF, 0x76, 0xFD, 0xFF,
        0xFF, 0xFF, 0x76, 0xFD, 0xFF, 0xFF, 0xFF, 0x76,
        0xFD, 0xFF, 0xFF, 0xFF, 0x05, 0xC4, 0xB3, 0x4F,
        0x5C, 0x05, 0xC4, 0xB3, 0x4F, 0x5C, 0x01, 0x0C,
        0xB0, 0xC0, 0x13, 0x69, 0xCC, 0xF5, 0xC0, 0x14,
        0x7B, 0xDC, 0xF5, 0xC4, 0x14, 0x73, 0xE5, 0xD5,
        0xC5, 0xFF, 0x5B, 0x7C, 0x31, 0xC0, 0x02, 0x57,
        0x8C, 0xF1, 0xC0, 0x13, 0x7B, 0xDC, 0x55, 0x44,
        0x2F, 0x05, 0x00, 0xF1, 0xFF, 0xFF, 0xFF, 0xFF,
        0x5F, 0xC0, 0x0E, 0x05, 0xEC, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x6A, 0x01, 0x00, 0x00,
        0x06, 0x1B, 0x8E, 0x09, 0x6C, 0x39, 0x00, 0x00,
        0x00, 0x00 ,0x6C, 0x39, 0x17, 0x0F, 0x08, 0x01,
        0x14, 0x00, 0x38, 0x47, 0x60, 0x44, 0x00, 0x00,
        0x00, 0x00, 0xBC, 0xC2, 0xAC, 0xA0, 0xB4, 0x94,
        0x94, 0xC8, 0x00, 0xA0, 0x80, 0x94, 0xC2, 0x42,
        0x42, 0x40, 0x00, 0x00, 0xFE, 0xFE, 0xFE, 0xFE,
        0xFE, 0xFE, 0x10, 0xA0, 0xC0, 0x00, 0x00, 0x00,
        0x00, 0x00
        };
//static unsigned int sensor_config[370]={
//        0x76, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
//        0x00, 0x00, 0x00, 0x00, 0xAB, 0x17, 0x01, 0x00,
//        0x00, 0x01, 0x00, 0x04, 0x00 ,0x90, 0x17, 0x00,
//        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//        0x00, 0x00, 0x00, 0xAC, 0x17, 0x00, 0x00, 0x06,
//        0x04, 0x04, 0x04, 0xC4, 0x00, 0x20, 0x20, 0x04,
//        0x00, 0x05, 0x00, 0x05, 0x01, 0x04, 0x00, 0x8B,
//        0x15, 0xFF, 0x07, 0x01, 0x00, 0x00, 0x86, 0x01,
//        0x90, 0x02, 0x0C, 0x00, 0x01, 0xDC, 0xF1, 0xFF,
//        0xFF, 0x72, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
//        0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
//        0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x76, 0xFD, 0xFF,
//        0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF9,
//        0x34, 0xF4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
//        0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xA9, 0xFC,
//        0x9F, 0xCA, 0xFF, 0xD9, 0xFC, 0x9F, 0xCD, 0xFF,
//        0x76, 0xFD, 0xFF, 0xFF, 0xFF, 0x76, 0xFD, 0xFF,
//        0xFF, 0xFF, 0x76, 0xFD, 0xFF, 0xFF, 0xFF, 0x76,
//        0xFD, 0xFF, 0xFF, 0xFF, 0x05, 0xC4, 0xB3, 0x4F,
//        0x5C, 0x05, 0xC4, 0xB3, 0x4F, 0x5C, 0x01, 0x0C,
//        0xB0, 0xC0, 0x13, 0x69, 0xCC, 0xF5, 0xC0, 0x14,
//        0x7B, 0xDC, 0xF5, 0xC4, 0x14, 0x73, 0xE5, 0xD5,
//        0xC5, 0xFF, 0x5B, 0x7C, 0x31, 0xC0, 0x02, 0x57,
//        0x8C, 0xF1, 0xC0, 0x13, 0x7B, 0xDC, 0x55, 0x44,
//        0x2F, 0x05, 0x00, 0xF1, 0xFF, 0xFF, 0xFF, 0xFF,
//        0x5F, 0xC0, 0x0E, 0x05, 0xEC, 0x00, 0x00, 0x00,
//        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//        0x00, 0x00, 0x00, 0x00, 0x6A, 0x01, 0x00, 0x00,
//        0x06, 0x0F, 0x8E, 0x09, 0x6C, 0x39, 0x00, 0x00,
//        0x00, 0x00 ,0x6C, 0x39, 0x07, 0x0F, 0x0E, 0x01,
//        0x14, 0x00, 0x38, 0x47, 0x60, 0x44, 0x00, 0x00,
//        0x00, 0x00, 0xBC, 0xC2, 0xAC, 0xA0, 0xB4, 0x94,
//        0x94, 0xC8, 0x00, 0xA0, 0x80, 0x94, 0xC2, 0x42,
//        0x42, 0x40, 0x00, 0x00, 0xFE, 0xFE, 0xFE, 0xFE,
//        0xFE, 0xFE, 0x10, 0xA0, 0xC0, 0x00, 0x00, 0x00,
//        0x00, 0x00
//        };

//sensor init
void sensor_config_init();

/*
 * note:sensor start to streaming
 * 0:stop streaming goto idle state
 * 1:start streaming goto output image state
*/
void sensor_streaming_mode(unsigned int streaming_mode_param);

/*
 * note:it is external only when camera_mode is camera_mode_photo and photo_mode is trigger_mode_external_level;
 * 0:external
 * 1:internal
*/
void sensor_exp_mode(unsigned int exp_param);

/*
 * note:make the sensor to ouptut test image
 * 0:nomal image
 * 1:test image
*/
void sensor_test_mode(unsigned int test_param);

/*
 * note:make the image horizontal flip
 * 0:close
 * 1:open
*/
void sensor_flip(unsigned int flip_param);

/*
 * note:set the internal exp time, the exp_param[0] is exp_f,the exp_param[1] is exp_c[7:0],the exp_param[2] is exp_c[15:8],the exp_param[3] is exp_c[23:16].all range is 0 to 255
 * the unit of exp_f is 4*4*13.888ns and exp_c is 4*196*13.888ns, exept every exp has 1140*13.888ns time
*/
void sensor_exp(unsigned int exp_param[4]);

/*
 * note:sub_smp_space
*/
void sensor_subsmp(unsigned int subsmp_param);

/*
 * note:image win1 size, win1_param[0] is win1_s[7:0],win1_param[1] is win1_s[15:8],win1_param[2] is win1_l[7:0],win1_param[3] is win1_l[15:8],all range is 0 to 255
*/
void sensor_win1(unsigned int win1_param[4]);

/*
 * note:image win2 size, win2_param[0] is win2_s[7:0],win1_param[1] is win2_s[15:8],win2_param[2] is win2_l[7:0],win2_param[3] is win2_l[15:8],all range is 0 to 255
*/
void sensor_win2(unsigned int win2_param[4]);

/*
 * note:image win3 size, win3_param[0] is win3_s[7:0],win3_param[1] is win3_s[15:8],win3_param[2] is win3_l[7:0],win3_param[3] is win3_l[15:8],all range is 0 to 255
*/
void sensor_win3(unsigned int win3_param[4]);

/*
 * note:image win4 size, win4_param[0] is win4_s[7:0],win4_param[1] is win4_s[15:8],win4_param[2] is win4_l[7:0],win4_param[3] is win4_l[15:8],all range is 0 to 255
*/
void sensor_win4(unsigned int win4_param[4]);

/*
 * note:it illustrate that the max length of one line is 4*sensor_line_u_length,line_u_length_param[0] is line_u_length[7:0] line_u_length_param[1] is line_u_length[15:8], all range is 0 to 255
*/
void sensor_line_u_length(unsigned int line_u_length_param[2]);

/*
 * note:the sensor analog gain,0~6 level,please input within 0 to 6
*/
void sensor_again(unsigned int sensor_again_param);

/*
 * note:sensor black level parameters,black_level_param[0] is black_level[7:0] range is 0 to 255, black_level_param[1] is black_level[15:8],range is 0 to 63.
*/
void sensor_black_level(unsigned int black_level_param[2]);

/*
 * note:the sensor digital gain,0~6 level,please input within 0 to 6
*/
void sensor_dgain(unsigned int sensor_dgain_param);

/*
 * note:read the data from the sensor at addr of sensor_status_addr range is 0 to 369;
*/
unsigned int sensor_status(unsigned int sensor_status_addr);


#endif // SENSOR_CONFIG_H
